(function(window,$,undefined){
  'use strict';



  var userData = {};


  main(function(){
    var $tableOrigin = $('#table-origin');
    util.jqGrid($tableOrigin,{
      url:'/json/pb.json',
      datatype:'json',
      autowidth: true,
      height: $(window).height() - 350,
      multiselect: true,
      multiboxonly: true,
      shrinkToFit: false,
      colModel: [
        { label: '编号', key: true, name: '', width: 60 },
        {
          label: '客户ID', name: '', width: 60,
        },
        { label: '手机号码', name: '', width: 180 },
        { label: '昵称', name: '', width: 80 },
        { label: '用户状态', name: '', width: 80 },
        { label: '注册时间', name: '', width: 150 , formatter: function (v, o, r) {
          return util.getDate(v);},
        },
        { label: '注册ip', name: '', width: 100 },
        { label: '注册活动类型', name: '', width: 100 },
        { label: '用户来源', name: '', width: 80 }
      ],
      loadComplete: function (res) {
        userData = {};
        if (res && res.data) {
          $.each(res.data, function (_, item) {
            userData[item.kid] = item;
          });
        }
      },
      pager:'#pager-origin'
    })

    laydate.render({
      range: '至',
      elem: '#register-time',
      done: function (value, date, endDate) {
        console.log(value, date, endDate);
        var temp = value.split('至');
        $('#register-time').next().val($.trim(temp[0])).next().val($.trim(temp[1]));
      }
    });

  });
})(window,jQuery);
